﻿<%@ Import Namespace="AspNetMvc.Entities" %>
<%@ Import Namespace="Infrastructure.Events" %>
<%@ Import Namespace="VirtuosoDal.Repositories.RdfRepositories.Events" %>
<%@ Import Namespace="WebGuiMvc.Helpers" %>
<%
    if (Model.Description.IsHierarchy)
    {
        var eventsOntologyClassesService =
           new EventsOntologyClassesService(new EventsOntologyClassesTreeBuilder(new EventsOntologyRepository()));
        var classesTree = eventsOntologyClassesService.GetClassesTree(Model.Description.HierarchyRootUri, (string)Session["Language"]);
        List<SelectListItem> items = HierarchyHelper.GetHierarchyAsList(classesTree, Model.Value, Model.ViewType);
        string dropDownClass = null;
        if (Model.ViewType == EventViewType.Create || Model.ViewType == EventViewType.Edit)
        {
            if (Model.Description.IsMultiValued)
                dropDownClass = "fo1";
            else
                dropDownClass = "fo2";
        }
        else if (Model.ViewType == EventViewType.Search)
        {
            if (Model.Description.IsMultiValued)
                dropDownClass = "fo17";
            else
                dropDownClass = "fo9";
        }
        
%>
<%= Html.DropDownList(Model.Id, items, new { @class = dropDownClass })%>
<%
    }
    else if (Model.Description.IsMultiline)
    {
%>
<%= Html.TextArea(Model.Id, Model.Value) %>
<%
    }
    else
    {
%>
<%= Html.TextBox(Model.Id, Model.Value) %>
<%
    }
%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<AspNetMvc.Models.ViewProperty>" %>